package org.example.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.domain.Role;
import org.example.mapper.RoleMapper;
import org.example.service.IRoleService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author blackTry
 * @since 2021-04-27
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService {

    @Override
    public Integer addRole(Role role) {
        return this.baseMapper.insert(role);
    }

    @Override
    public Integer removeRolesByIds(List<Long> ids) {
        return this.baseMapper.deleteBatchIds(ids);
    }

    @Override
    public Integer updateRole(Role role) {
        return this.baseMapper.updateById(role);
    }

    @Override
    public Role getOneById(Long id) {
        return this.baseMapper.selectById(id);
    }

    @Override
    public List<Role> getRoles(Long identityId) {
        return this.baseMapper.getRoles(identityId);
    }

}
